home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 5 / MacMania 5.toast / / Tools&Utilities / Plotfoil 3.2 / naca-1.0 / naca.f < prev    next >
Text File  |  1995-09-13  |  3KB  |  118 lines

  1. c
  2. c-----------------------------------------------------------------------------
  3. c
  4. c  Naca.f -- generates a NACA foil section, printing the foil coordinates
  5. c            to stdout in a format usable by gnuplot.
  6. c
  7. c  Written By: S.E.Norris
  8. c
  9. c  norris@cfd.mech.unsw.edu.au
  10. c
  11. c  $RCSfile: naca.f,v $
  12. c  $Author: norris $
  13. c  $Revision: 1.7 $
  14. c  $Date: 1995/08/31 11:05:52 $
  15. c
  16. c  $Log: naca.f,v $
  17. c  Revision 1.7  1995/08/31  11:05:52  norris
  18. c  *** empty log message ***
  19. c
  20. c  Revision 1.6  1995/08/31  07:30:19  norris
  21. c  Cleaned up code.
  22. c
  23. c  Revision 1.5  1995/08/31  06:30:07  norris
  24. c  Removed an unwanted variable, scle.
  25. c
  26. c  Revision 1.4  1995/08/31  04:43:30  norris
  27. c  Modified internal reads for the Cray cf77 compiler.
  28. c
  29. c  Revision 1.3  1995/08/31  04:08:27  norris
  30. c  Corrected a bug in the naca utility -- return statement instead of exit().
  31. c
  32. c  Revision 1.2  1995/08/31  02:20:00  norris
  33. c  Check command line args to see that numbers are entred.
  34. c
  35. c  Revision 1.1  1995/08/31  02:03:05  norris
  36. c  Initial revision
  37. c
  38. c-----------------------------------------------------------------------------
  39. c
  40. c
  41.       IMPLICIT none
  42.       INTEGER npl               ! Number of points on foil
  43.       INTEGER npmx              ! Size of points array
  44.       PARAMETER (npmx=500)
  45.       INTEGER inaca             ! Returns Foil thickness
  46.       INTEGER nmn               ! Returns increase in length of name
  47.       REAL x(3,npmx)            ! Returns Array of points on foil
  48.       REAL scle                 ! Length of foil
  49.       CHARACTER naca*(20)       ! String containing NACA number
  50.       LOGICAL t_n               ! Returns if foil created
  51.       INTEGER i
  52.       INTEGER ierr
  53.       CHARACTER buff*(10)
  54. c
  55.       INTEGER Iargc,Lnblnk
  56.       LOGICAL Digit
  57.       EXTERNAL Iargc,Getarg     ! UNIX library functions
  58.       EXTERNAL Digit,Lnblnk
  59. c
  60.       DATA scle / 1.0 /
  61. c
  62. c     Check for correct number of command line args
  63. c
  64.       if (Iargc().ne.2 .or. naca(1:2).eq.'-h') call Error()
  65. c
  66. c     Get command line args
  67. c
  68.       call Getarg(1,naca)
  69.       call Getarg(2,buff)
  70.       if (.not.Digit(buff,Lnblnk(buff))) call Error()
  71.       read(buff,'(i10)',iostat=ierr) npl
  72.       if (ierr.ne.0) call Error()
  73. c
  74. c     Check size of arrays
  75. c
  76.       if (npl.ge.npmx) then
  77.          print '(a,i5)', 'naca: Maximum number of points is ',npmx
  78.          call exit(1)
  79.          stop
  80.       endif
  81. c
  82. c     Generate foil
  83. c
  84.       call NacaFoil( x,npl,npmx,naca,scle,inaca,t_n,nmn )
  85. c
  86. c     Check that we could create the foil
  87. c
  88.       if (.not. t_n) then
  89.          print '(3a)', 'naca: Could not create the ',
  90.      &                  naca(1:Lnblnk(naca)),' section'
  91.          call exit(1)
  92.          stop
  93.       endif
  94. c
  95. c     Print out the foil to stdout
  96. c
  97.       print '(2a)', '# NACA ',naca(1:Lnblnk(naca))
  98.       do i = 1,npl+1
  99.          print '(g20.10,1x,g20.10)', x(1,i),x(2,i)
  100.       enddo
  101. c
  102.       call exit(0)
  103.       stop
  104.       END
  105. c
  106. c-----------------------------------------------------------------------------
  107. c
  108.       SUBROUTINE Error()
  109. c
  110.       print '(a)', 'Usage: naca NACA_Number Number_of_points'
  111.       call exit(1)
  112.       stop
  113.       END
  114.  
  115.  
  116.  
  117.  
  118.